-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make editor's shortcut names translated on-site #99158
base: master
Are you sure you want to change the base?
Conversation
4d20b21
to
cfce460
Compare
cfce460
to
1989075
Compare
1989075
to
6c413f8
Compare
Updated the PR to change related tooltip texts to use Technically most button's tooltip text can be changed to use |
You missed this one (and possibly more?): godot/editor/plugins/node_3d_editor_plugin.cpp Line 8895 in 3877573
Which exposed another problem, though not directly related. When you search for a shortcut in settings dialog, it will only match original English name. Before this PR the dialog only matched the translated name. I think it should match both. We can improve it later. EDIT: |
6c413f8
to
470c47c
Compare
Updated that new shortcut's name. The matching rules when searching for shortcuts seemed relatively simple to modify, so I made the changes as well. (I had already modified the settings dialog originally to adjust the display logic of the list.) godot/editor/editor_settings_dialog.cpp Lines 435 to 463 in 470c47c
|
When it's necessary to translate the name of a shortcut, the in-game solution is to automatically translate it when it's displayed (e.g. when the shortcut's name is displayed in a button's tooltip).
The editor code takes advantage of the fact that changing the editor language requires a restart. It translates the name once when the shortcut object is created.
Doing so leads to possible redundant double translations in the editor. It also creates inconsistencies in the way translations are done in the editor and in the game, which is not conducive to improving the translation system.
In this PR:
TTRC()
instead ofTTR()
to mark a shortcut's name.TTRC()
is just a marker and does not translate.TTR()
toTTRC()
. This allows the button to avoid duplicate text automatically, as well as double translations.Note that the disadvantage of changing to
TTRC()
is that it does not support translation contexts. In theory, you still need to manually translate and change the name inNOTIFICATION_TRANSLATION_CHANGED
in such case.In editor codebase, the only place this happens is the tiles editor where we added context for
Line
. The shortcut is for drawing straight lines and needs to be distinguished from representing a line of text.godot/editor/plugins/tiles/tiles_editor_plugin.cpp
Lines 313 to 316 in cb411fa
The translation context here could actually be eliminated if the name itself was more precise. Therefore, I took the liberty of suffixing these shortcuts' names with "Tool".
godot/editor/plugins/tiles/tiles_editor_plugin.cpp
Lines 313 to 316 in 4d20b21